package com.code.family.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.code.family.entity.pojo.Accounts;
import com.code.family.service.AccountsService;
import com.code.family.mapper.AccountsMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class AccountsServiceImpl extends ServiceImpl<AccountsMapper, Accounts>
    implements AccountsService{
    @Resource
    private AccountsMapper accountsMapper;

    // 新增账户
    @Override
    public boolean addAccount(Accounts accounts) {
        if (accountsMapper.addAccount(accounts) > 0) {
            // 如果插入成功，返回true
            return true;
        }
        return false;
    }
    //删除
    @Override
    public boolean deleteAccount(int id) {
        if (accountsMapper.deleteAccount(id) > 0) {
            // 如果插入成功，返回true
            return true;
        }
        return false;
    }
    //更新
    @Override
    public boolean update(Accounts accounts) {
        if (accountsMapper.updateById(accounts) > 0) {
            // 如果更新成功，返回true
            return true;
        }
        return false;
    }
}




